import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Vant, {Toast} from 'vant';
import 'vant/lib/index.css';
import less from 'less'
import '@/style/index.css'
import VueCropper from 'vue-cropper'
import axios from 'axios'

Vue.config.productionTip = false

Vue.use(Vant);
Vue.use(less)

Vue.use(VueCropper)

// Vue.prototype.baseUrl =''
Vue.prototype.baseUrl ='/heka/app'
axios.interceptors.response.use(
    async (response) => {
      console.log(response)
        if (response.data.code === 401 || response.data.msg === 'token已失效或为非法值') {
            wx.miniProgram.redirectTo({
                url: `/pages/login/index`
            })
            console.log('response.data.msg',response.data.msg)
            Toast.fail(response.data.msg)
            return Promise.reject(response.data.msg)
        }
        return response
    }
)
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
